﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Brjostagjof_H4.Models.EntryModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Brjóstagjöf.is | Breyta
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h3>Breyta</h3>
    <table id="main-table">
        <tr>

            <td id="main-table-left">
                <script type="text/javascript">
                    $(document).ready(function () {
                        loadCategories();
                    });
                </script>
	                <section>
	                    <% using (Html.BeginForm()) {%>
		                    <%: Html.ValidationSummary(true) %>
		
		                    <fieldset class="entry-form">
			                    <legend></legend>
			
			                    <div class="editor-label">
				                    <%: Html.LabelFor(model => model.title) %>
			                    </div>
			                    <div class="editor-field">
				                    <%:Html.TextBoxFor(model => model.title) %> 
				                    <%: Html.ValidationMessageFor(model => model.title) %>
			                    </div>
			
			                    <div class="editor-label">
				                    <%: Html.LabelFor(model => model.content) %>
			                    </div>
			                    <div class="edit-entry-content">
				                    <%: Html.TextAreaFor(model => model.content)%>
				                    <%: Html.ValidationMessageFor(model => model.content) %>
			                    </div>         

			                    <div class="editor-label">
				                    <%: Html.LabelFor(model => model.category) %>
			                    </div>
			                    <div>
				                    <select class="category-dropdown" name="category" id="category">
				                    </select>
			                    </div>
			                    <div class="editor-label">
				                    <%: Html.LabelFor(model => model.entry_type) %>
			                    </div>                       
			                    <div class="editor-field">
				                    <%: Html.DropDownListFor(model => model.entry_type, new SelectList(Brjostagjof_H4.Models.entryType.entryTypes, "typeID", "name")) %>
				                    <%: Html.ValidationMessageFor(model => model.entry_type) %>
			                    </div>
                                <div class="editor-field"> <%-- TODO olig - maybe trim this form a bit more. Could use better controls than radio buttons. 
                                                                and have the current state selected on page load. jQuery and json.--%>
                                    <input type="radio" name="entry_status" id="published" value="1" /><label for="published"> Birt</label><br />
                                    <input type="radio" name="entry_status" id="hidden" value="2" /><label for="hidden" checked="checked"> Falið</label><br />
                                    <input type="radio" name="entry_status" id="remove" value="3" /><label for="remove"> Eyða (óafturkræft)</label><br />
                                </div>
			                    <div>
				                    <input type="submit" value="Vista breytingu" />
				                    <span class="cancel-link"><%: Html.ActionLink("Hætta við", "Entries", "Admin") %></span>
			                    </div>
		                    </fieldset>

	                    <% } %>

	                </section>
	                <!-- Template -->
	                <script id="category-template" type="text/x-jquery-tmpl">
		                <option value='${categoryID}'>${categoryName}</option> 
	                </script>
            </td>

            <td id="main-table-right">
                <div class="options">
                    <% if (User.IsInRole("Administrators")){Html.RenderPartial("~/Views/Home/ProfileAdminMenu.ascx", "Model");} %>
                    <% else if (User.IsInRole("Professionals")) { Html.RenderPartial("~/Views/Home/ProfileProMenu.ascx", "Model"); } %>
                    <% else { Html.RenderPartial("~/Views/Home/ProfileMenu.ascx", "Model"); } %>
                </div>
            </td>

        </tr>
    </table>

</asp:Content>

